/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package plar;

/**
 *
 * @author spok
 */

import java.util.Vector;

public class Sprites
{
	private Vector <Sprite> sprites;
        private Sprite currentSprite;
	private int speed;
	private int loop;
	
        public void setSpeed(int s)
        {
            speed = s;
        }
        
	public Sprites()
	{
		sprites = new Vector <Sprite>();
                currentSprite=new Sprite("");
	}

	public Sprites(Vector <Sprite> s)
	{
		sprites = s;
                if(s.size()>0 ) currentSprite=s.elementAt(0);
                else currentSprite = new Sprite("");
	}
	
	public Sprites(Sprite  s)
	{
		sprites = new Vector <Sprite>();
		sprites.add(s);
                currentSprite=s;
	}
        
        public void addSprite(Sprite s)
        {
            sprites.add(s);
            
        
        }
        
        public Sprite getCurrentSprite()
        {
         return currentSprite;
        }
        
        public void clock()
        {
            boolean next=false;
         for(Sprite s: sprites)
         {
             if(next)
             {
                 currentSprite=s;
                 next=false;
                 break;
                 
             }
             if(s==currentSprite) next=true;
         }
         if(next) currentSprite = sprites.elementAt(0);
        }
}
